package strategy

import "fmt"

type Payment interface {
	Pay(float64) error
}

type AliPay struct {}

func (p *AliPay) Pay(amount float64) error {
	fmt.Println("使用支付宝支付:", amount)
	return nil
}

type WechatPay struct {}

func (p *WechatPay) Pay(amount float64) error {
	fmt.Println("使用微信支付:", amount)
	return nil
}

type PaymentContext struct {
	payment Payment
}

func (p *PaymentContext) SetPayment(payment Payment) {
	p.payment = payment
}

func (p *PaymentContext) Pay(amount float64) error {
	return p.payment.Pay(amount)
}


